<?php

namespace SisGG\FinalBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use SisGG\FinalBundle\Form\ProvinciaType;

class CiudadType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('nombre')
            ->add('codigoPostal', null, array(
                'invalid_message' => 'Debe ser un número de cuatro dígitos',
               'label' => 'Código Postal',
                    ))
            ->add('provincia')
        ;
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'SisGG\FinalBundle\Entity\Ciudad'
        ));
    }

    public function getName()
    {
        return 'sisgg_finalbundle_ciudadtype';
    }
}
